<!DOCTYPE html>
<html  class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">  
    <head>
        <meta charset="UTF-8">
        <title>PingPangTask-0.1</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <base th:href="@{/}">
        <link rel="stylesheet" href="static/css/font.css">
        <link rel="stylesheet" href="static/css/xadmin.css">
        <script type="text/javascript" th:src="@{/static/js/jquery.min.js}"></script>
        <script type="text/javascript" src="static/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="static/js/xadmin.js"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
            <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
            <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]--></head>
    
    <body>
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form">
                    <input type="hidden" id="id" name="id" th:value="${taskRunBean.id}"/>
                    <div class="layui-form-item">
                        <label for="name" class="layui-form-label">
                            <span class="x-red">*</span>任务名称</label>
                        <div class="layui-input-inline">
                            <input type="text" id="name" name="name" th:value="${taskRunBean.name}" required="" lay-verify="required" autocomplete="off" class="layui-input"></div>
                    </div>
                    <div class="layui-form-item">
                        <label for="param" class="layui-form-label">参数</label>
                        <div class="layui-input-inline">
                            <input type="text" id="param" name="param" th:value="${taskRunBean.param}" required=""  autocomplete="off" class="layui-input"></div>
                    </div>
                    <div class="layui-form-item">
                        <label for="registID" class="layui-form-label">
                            <span class="x-red">*</span>注册任务</label>
                        <div class="layui-input-inline">
                            <!-- <input type="text" id="registID" name="registID" th:value="${taskRunBean.registID}" required="" lay-verify="required" autocomplete="off" class="layui-input"></div> -->
                            <select name="registID" lay-verify="required">
                            <option 
	                           th:each="regist : ${taskRegists}"
	                           th:value="${regist.id}"
	                           th:text="${regist.name}+'_'+${regist.method}+'_'+${regist.ipport}"
	                           th:selected="${regist.id eq taskRunBean.registID}">
	                         </option>
                            </select> 
                    </div>
                    <div class="layui-form-item">
                        <label for="purpose" class="layui-form-label">
                            <span class="x-red">*</span>备注</label>
                        <div class="layui-input-inline">
                            <input type="text" id="purpose" name="purpose" th:value="${taskRunBean.purpose}" required="" lay-verify="required" autocomplete="off" class="layui-input"></div>
                    </div>
                    <div class="layui-form-item">
                        <label for="corn" class="layui-form-label">
                            <span class="x-red">*</span>corn</label>
                        <div class="layui-input-inline">
                            <input type="text" id="corn" name="corn" th:value="${taskRunBean.corn}" required="" lay-verify="required" autocomplete="off" class="layui-input"></div>
                    </div>
            <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label"></label>
              <button class="layui-btn" lay-submit lay-filter="add"><p th:if="${taskRunBean.id!=null}">修改</p><p th:if="${taskRunBean.id==null}">增加</p></button>
            </div>
        </form>
        </div>
        </div>
        <script>
        $(function  () {
            layui.use('form', function(){
              var form = layui.form;

        		form.on('submit(add)', function(data){
              	  $.ajax({
              		  type: 'POST',
              		  async: false,
              		  dataType:'json',
              		  contentType: "application/json",
              		  url:'taskManager/addTaskRunBean',
              		  data: JSON.stringify(data.field),
              		  success: function(data){
              			  if("S"==data.CODE){
              				xadmin.close();　
              				xadmin.father_reload();
              			  }
              			  layer.msg(data.MESSAGE,{time:2000,end:function(){
              			  }});
              		  },
              		  error : function(errorMsg) {
                            layer.msg(errorMsg,{time:2000,end:function(){
              			  }});
              		  }
              		});
              	  return false;
                });
            });
        });
        </script>
    </body>

</html>